package projecteuler;

import java.util.ArrayList;

public class Problem21
{
    public static void main(String[] args)
    {
        long now = System.currentTimeMillis();
        ArrayList<Integer> amicableNumbers = new ArrayList<Integer>();
        int limit = 10000;
        for (int i = 0; i < limit; i++)
        {
            if (!amicableNumbers.contains(i))
            {
                int amicablePair = Utils.getAmicable(i); 
                if (amicablePair > 0)
                {
                    amicableNumbers.add(i);
                    amicableNumbers.add(amicablePair);
                }
            }
        }
        
        int sumTestAmicables = 0;
        for (int i : amicableNumbers)
        {
            sumTestAmicables += i;
        }
        System.out.println(sumTestAmicables);
        System.out.println((System.currentTimeMillis() - now) + "ms");
    }
    
    

    
}
